<?php
/**
 *      [迷你云] (C)2009-2012 南京恒为网络科技.
 *   软件仅供研究与学习使用，如需商用，请访问www.miniyun.cn获得授权
 * 
 */
?>
<?php


class MOptionOperate
{
    
    public function getAppName(){
        $option = new MOptions();
        $key = "site_name";
        $option->queryMeta($key);
        if ($option === false){
            return "迷你云";
        }
        return $option->option_value;
    }


    
    public function getAppLogo(){
        $option = new MOptions();
        $key = "app_logo";
        $option->queryMeta($key);
        if ($option === false){
            return "";
        }
        return $option->option_value;
    }


    
    public function getRegisterUrl(){
        $option = new MOptions();
        $key = "register_url";
        $option->queryMeta($key);
        if ($option === false){
            return "http://".$_SERVER ['HTTP_HOST']."/index.php?r=register/index";
        }
        return $option->option_value;
    }


    
    public function getRegisterInfo(){
        $register = array();
        $register['enabled']   = $this->getRegisterStatus();
        $register['url']       = $this->getRegisterUrl();
        return $register;
    }


    
    public function getRegisterStatus(){
        $option = new MOptions();
        $key = "register_status";
        $option->queryMeta($key);
        if ($option === false){
            return false;
        }
        return (boolean)$option->option_value;
    }

    
    public function getFindPasswordUrl(){
        $option = new MOptions();
        $key = "find_password_url";
        $option->queryMeta($key);
        if ($option === false){
            return  "http://".$_SERVER ['HTTP_HOST']."/index.php?r=findPassword/index";
        }
        return $option->option_value;
    }

    
    public function getFindpasswordStatus(){
        $option = new MOptions();
        $key = "find_password_status";
        $option->queryMeta($key);
        if ($option === false){
            return false;
        }
        return (boolean)$option->option_value;
    }


    
    public function getFindPasswordInfo(){
        $data = array();
        $data['enabled']   = $this->getFindpasswordStatus();
        $data['url']       = $this->getFindPasswordUrl();
        return $data;
    }


    
    public function getCompanyName(){
        $option = new MOptions();
        $key = "company_name";
        $option->queryMeta($key);
        if ($option === false){
            return "";
        }
        return $option->option_value;
    }

    
    public function getCompanyUrl(){
        $option = new MOptions();
        $key = "company_url";
        $option->queryMeta($key);
        if ($option === false){
            return "";
        }
        return $option->option_value;
    }

    
    public function getCompnayInfo(){
        $data = array();
        $data['company']   = $this->getCompanyName();
        $data['url']       = $this->getCompanyUrl();
        return $data;
    }

    
    public function getAndroidLogo(){
        $option = new MOptions();
        $key = "site_logo";
        $option->queryMeta($key);
        if ($option === false){
            return "http://".$_SERVER ['HTTP_HOST']."/statics/images/logo.png";
        }
        return $option->option_value;
    }

    
    public function getIpadLogo(){

        $option = new MOptions();

                $key = "ipad_logo_portrait";
        $option->queryMeta($key);
        if ($option === false){
            $ipad_logo_portrait =  "http://".$_SERVER ['HTTP_HOST']."/statics/images/ipad-Landscape.png";
        }else{
            $ipad_logo_portrait = $option->option_value;
        }

                $key = "ipad_logo_landscape";
        $option->queryMeta($key);
        if ($option === false){
            $ipad_logo_landscape =  "http://".$_SERVER ['HTTP_HOST']."/statics/images/ipad-Portrait.png";
        }else{
            $ipad_logo_landscape = $option->option_value;
        }

        $ipad_logo = array();
        $ipad_logo['ipad_logo_portrait']   = $ipad_logo_portrait;
        $ipad_logo['ipad_logo_landscape']  = $ipad_logo_landscape;
        return $ipad_logo;
    }



    
    public function getIphoneLogo(){

        $option = new MOptions();

                $key = "iphone_logo_big";
        $option->queryMeta($key);
        if ($option === false){
            $iphone_logo_big =  "http://".$_SERVER ['HTTP_HOST']."/statics/images/iPhone-big.png";
        }else{
            $iphone_logo_big = $option->option_value;
        }

                $key = "iphone_logo_small";
        $option->queryMeta($key);
        if ($option === false){
            $iphone_logo_small =  "http://".$_SERVER ['HTTP_HOST']."/statics/images/iPhone-small.png";
        }else{
            $iphone_logo_small = $option->option_value;
        }

        $iphone_logo = array();
        $iphone_logo['iphone_logo_big']    = $iphone_logo_big;
        $iphone_logo['iphone_logo_small']  = $iphone_logo_small;
        return $iphone_logo;
    }
}

?>